package com.xy.biz.xd.domain.enums;

import io.swagger.models.auth.In;

import java.util.HashMap;
import java.util.Map;

public enum DocumentFlownNewEnum {

//    START("newApply", "管理员审核中"),
    APPLY("newApply","待申请"),
    AUDIT("adminAudit","管理员审核中"),
    DRAFT("draft","待起草文件"),
    REVIEW("review","评审人评审中"),
    REVISE("revise","起草人修订中"),
    RECHECK("audit","审核人审核中"),
    RATIFY("approve","批准人批准中"),
    RELEASED("release","待管理员释出文件"),
    END("endevent1","流程结束");

    private String code;
    private String phase;

    DocumentFlownNewEnum() {
    }

    DocumentFlownNewEnum(String code, String phase) {
        this.code = code;
        this.phase = phase;
    }

    public String getCode() {
        return code;
    }

    public String getPhase() {
        return phase;
    }

    // 将数据缓存到map中
    private static final Map<String, String> map = new HashMap<String, String>();

    static {
        for (DocumentFlownNewEnum value : DocumentFlownNewEnum.values()) {
            map.put(value.getCode(),value.getPhase());
        }
    }

    // 根据code查询phase值
    public static String getCodeByPhase(String code) {
        return map.get(code);
    }
}
